﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DAL;

namespace BLL
{
    public class Login
    {
        public Boolean DoLogin(String username, String password)
        {
            var dt = new DataTable();
            dt = ThanhVien.Find(username, password);
            if (dt == null)
                return false;
            var i = dt.Rows.Count;
            if (i > 0)
            {
                var member = new BoThanhVien();
                DataRow dr = dt.Rows[0];
                member.TenThanhVien = dt.Rows[0]["TenThanhVien"].ToString();
                member.MatKhau = dt.Rows[0]["MatKhau"].ToString();
                member.MaVaiTro = (int)dt.Rows[0]["MaVaiTro"];
                Session.Member = member;
                return true;
            }
            return false;
        }
    }
}
